#pragma once

#include "PacketCapture.h"
#include "SendPacket.h"

class Socket;
class PyPacketFilter;

/////////////////////////////////////////////////
/// \class PySourceSetter
///
/// \brief Receive and set the filter python source
///
/// Receive python filter source from client
/// and set it to python packet filter
/////////////////////////////////////////////////
class PySourceSetter
{
public:

	/// Create the python source setter with python packet filter and packet capturer
	PySourceSetter(Socket& sock, PyPacketFilter& pyPacketFilter, PacketCapture<SendPacket<PyPacketFilter> >& packetCapture);

	virtual ~PySourceSetter();

	/////////////////////////////////////////////////
	/// \fn void operator()()
	///
	/// Receive python filter source from client
	/// and set it to python packet filter.
	/// Loop until the client socket has been closed.
	/////////////////////////////////////////////////
	void operator()();
private:
	Socket &m_socket;	/// The client socket
	PyPacketFilter &m_pyPacketFilter;	/// The python packet filter
	PacketCapture<SendPacket<PyPacketFilter> > &m_packetCapture;	/// The packet capturer
};
